//
//  UIViewController+GGRouteError.m
//  qqqqqq
//
//  Created by iOSer on 2017/3/3.
//  Copyright © 2017年 iOSer. All rights reserved.
//

#import "NSError+GGRouteError.h"
NSString * const GGErrorDomain = @"com.ggroute.error";
@implementation NSError (GGRouteError)

+(NSError *)GGNotFoundError{
    return [self GGErrorWithCode:GGErrorNotFound msg:@"The passed URL does not match a registered route."];
}
+(NSError *)GGTransitionError{
    
    return [self GGErrorWithCode:GGErrorHandlerTargetOrSourceViewControllerNotSpecified msg:@"TargetViewController or SourceViewController not correct"];
}
+(NSError *)GGHandleBlockNoTeturnRequest
{
    return [self GGErrorWithCode:GGErrorBlockHandleNoReturnRequest msg:@"Block handle no turn GGRouteRequest object"];
}

+(NSError *)GGMiddlewareRaiseErrorWithMsg:(NSString *)error{
    return [self GGErrorWithCode:GGErrorMiddlewareRaiseError msg:[NSString stringWithFormat:@"GGRouteMiddle raise a error:%@",error]];
}
+(NSError *)GGErrorWithCode:(NSInteger)code msg:(NSString *)msg{
    NSDictionary *userInfo = @{ NSLocalizedDescriptionKey: NSLocalizedString(msg, nil) };
    return [NSError errorWithDomain:GGErrorDomain code:code userInfo:userInfo];
}
@end
